package com.twu.biblioteca.options;

import com.twu.biblioteca.library.Users;
import com.twu.biblioteca.login.LoginStatus;
import com.twu.biblioteca.streams.AppOutputStream;

import java.io.IOException;

public class CheckMembershipDetails implements Option {

    @Override
    public void execute() throws IOException {
        if (LoginStatus.loggedInLibNumber != null) {
            String userInfo = new Users().getUserInfo(LoginStatus.loggedInLibNumber);
            AppOutputStream.writeLine(userInfo + "\n");
        } else {
            AppOutputStream.writeLine("Please talk to a Librarian. Thank you.\n");
        }
    }

    @Override
    public String toString() {
        return "Check Membership Details";
    }
}
